﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BL.Membership;

namespace OrderDesk.Controllers
{
    public class BaseController : Controller
    {
        public UserData CurrentUser { get; set; }

        public bool IsClientsAdmin { get; set; }

        public BaseController()
        {
            ViewBag.CurrentUser = CurrentUser =
                new OrderDeskMembership().GetCurrentLoggedInUser();

            ViewBag.IsAuthenticated = CurrentUser != null;

            if (CurrentUser == null)
                IsClientsAdmin = false;
            else
                IsClientsAdmin = CurrentUser.IsUserAllowed(UserPermission.AllClientsAdmin);

            ViewBag.IsClientAdmin = IsClientsAdmin;
        }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }
    }
}
